package com.lyb.android.app;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

import com.lyb.android.service.HttpService;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.app.Activity;

public class App extends Application {
	 
    public App mApp;

    
    @Override 
//    @ReportsCrashes(formKey = "dHZFcmN2UFpxZzNsS1EwRHZNWDVNZ3c6MQ")
    public void onCreate() {
    	ACRA.init(this);
        mApp = this;
        Intent serv = new Intent("com.lyb.android.service.HttpService");
        this.startService(serv);
        TelephonyManager tm;
		tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
		com.lyb.android.util.Util.IMEI = tm.getDeviceId();
        super.onCreate(); 
    }
  
    @Override 
    public void onTerminate() { 
        super.onTerminate();
    }
 
    public void destroy() { 
        for (Activity ac : HttpService.allActivity) {
            ac.finish();
        }
        Intent it = new Intent("com.lyb.android.service.HttpService");
        this.stopService(it);
        android.os.Process.killProcess(android.os.Process.myPid());
        System.exit(0);
    } 
}